# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models

# Create your models here.
from userapp.models import Address, UserInfo


class Order(models.Model):
    out_trade_num = models.UUIDField()
    order_num = models.CharField(max_length=50)
    trade_no = models.CharField(max_length=120)
    status = models.CharField(max_length=20,default='待支付')
    payway = models.CharField(max_length=20,default='alipay')
    address = models.ForeignKey(Address)
    user = models.ForeignKey(UserInfo)
    
    class Meta:
        db_table='order_order'   
        verbose_name="订单查询"
        verbose_name_plural=verbose_name

    def __str__(self):
        return self.order_num
    
    def __unicode__(self):
        return u'Order:%'%self.order_num
   
         



class OrderItem(models.Model):
    goodsid = models.PositiveIntegerField()
    colorid = models.PositiveIntegerField()
    sizeid = models.PositiveIntegerField()
    count = models.PositiveIntegerField()
    order = models.ForeignKey(Order)
    
